fix: make README programmatic example importable (closes #250)#253
Merged
Scottcjn merged 1 commit intoJul 4, 2026
Merged
Conversation
The README 'For Other MCP Clients' quick-start showed:
from rustchain_mcp import RustChainMCPServer
server = RustChainMCPServer(api_key="your-api-key")
but no RustChainMCPServer symbol (and no api_key constructor) exists —
rustchain_mcp/__init__.py exported only __version__, and the server is a
module-level FastMCP instance (rustchain_mcp/server.py -> mcp = FastMCP(...)),
which is what the rustchain-mcp console script already runs
([project.scripts] rustchain_mcp.server:mcp.run). Following the documented
example therefore raised ImportError.
Fix:
- Re-export the real server instance from the package (from .server import mcp),
matching the issue's suggested fix of exporting the documented symbol.
- Update the README example to the working API: from rustchain_mcp import mcp; mcp.run().
Verified: 'from rustchain_mcp import mcp; mcp.run' now imports cleanly and the
console entry point is unchanged.
jaxint
approved these changes
Jul 3, 2026
jaxint
left a comment
There was a problem hiding this comment.
PR Review
Reviewer: @jaxint
Wallet: AhqbFaPBPLMMiaLDzA9WhQcyvv4hMxiteLhPk3NhG1iG
Summary
This PR addresses: fix: make README programmatic example importable
Code Review
Changes Reviewed:
- Files: 2
- Lines: +17/-3
Assessment: ✅ Approved
The changes follow the project's coding standards and address the issue described in the PR title. The implementation is clean and minimal.
Testing
- Code changes are minimal and focused
- No additional test coverage required for this fix
Recommendation
APPROVE - Ready for merge.
Review submitted via RustChain Bounty System
RTC bounty claim: 40 RTC per review (Bounty #73)
RTC RewardThis merged PR earned 5 RTC — sent to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #250. The README quick-start "For Other MCP Clients" example was broken:
There is no
RustChainMCPServersymbol and noapi_keyconstructor.rustchain_mcp/__init__.pyexported only__version__, and the server is a module-levelFastMCPinstance inrustchain_mcp/server.py(mcp = FastMCP(...)) — the same object therustchain-mcpconsole script runs ([project.scripts]→rustchain_mcp.server:mcp.run). So anyone following the documented Python example hit anImportError.Fix
rustchain_mcp/__init__.py: re-export the real server instance (from .server import mcp) sofrom rustchain_mcp import mcpworks — this is the issue's suggested fix of "the package should export the documented symbol".__version__is preserved and__all__added.README.md: replace the non-existent class example with the working API:Verification
Fresh venv,
pip install fastmcp httpx, package installed from this branch:from rustchain_mcp import RustChainMCPServer→ImportErrorfrom rustchain_mcp import mcp; mcp.runimports cleanly (type=FastMCP, name"RustChain + BoTTube + Beacon")rustchain_mcp.__version__still0.4.0;__all__ == ['mcp', '__version__']rustchain_mcp.server:mcp.runstill resolvable and callable)Docs-vs-code only; no tool behavior changed.
/claim #250